package com.itheima.area.controller;

import com.itheima.area.pojo.CustFarmlandHistory;
import com.itheima.area.service.HistoryService;
import com.itheima.entity.Result;
import com.itheima.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @PackageName com.itheima.area.controller
 * @ProjectName Ceres-Work
 * @Created by Chanly on 2020/10/15 19:50
 **/
@RequestMapping("/history")
@RestController
public class HistoryController {
   @Autowired
   private HistoryService hsitoryService;
    @GetMapping
    public Result findHistoryRecord(){
        try {
            List<CustFarmlandHistory> custFarmlandHistoryList = hsitoryService.findAll();
            return new Result(true, StatusCode.OK,"查询所有成功",custFarmlandHistoryList);
        } catch (Exception e) {
            e.printStackTrace();
            return new Result(false,StatusCode.ERROR,"查询失败");
        }
    }
}
